/**
 * Created by zhangwenlei on 2017/5/1.
 */
ADF.control.Number = function() {
    ADF.control.Number.superclass.constructor.call(this);
};

COM.util.defineClass(ADF.control.Number,ADF.ControlDescriptor,{

    getEditpart:function () {
        var editpart=function () {
            editpart.superclass.constructor.call(this);
        };
        COM.util.defineClass(editpart,ADF.editpart.BaseEditpart,{
            _createFigure: function() {
                var NumberFigure = new AGEF.WidgetFigure(this.id);
                var Number = this.getWidgetFactory().createControl(this.getModel());
                NumberFigure.setWidget(Number);
                return NumberFigure;
            },
            // createEditPolicies: function() {
            //     this.installEditPolicy(COM.gef.EditPolicy.COMPONENT_ROLE, new AGEF.ComponentEditPolicy());
            // },
            propertyChange:function(evt){
                editpart.superclass.propertyChange.call(this,evt);
                if(AGEF.PropertyChangeEvent.UPDATE_EVENT == evt.getType()){
                   if(ADF.model.NumberModel.PROPERTY_ADFPRECISION==evt.getPropertyName()){
                       this.getFigure().getWidget().setADFPrecision(evt.newValue);
                   }else if(ADF.model.NumberModel.PROPERTY_ADFICON==evt.getPropertyName()){
                       this.getFigure().getWidget().setADFIcon(evt.newValue);
                   }else if(ADF.model.NumberModel.PROPERTY_QUARTILE==evt.getPropertyName()){
                       this.getFigure().getWidget().setQuartile(evt.newValue);
                   }
               }
            }
        });
        return editpart;
    },

    getModel : function(){
        return ADF.model.NumberModel;
    },

    getDomControl:function(){
        return ADF.domControl.Number;
    }

});